<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
	<link rel="apple-touch-icon" href="/favicon.ico">
	<title>53AI Hub</title>
</head>

<body>
	<script id="ueditor-container" name="content" type="text/plain"></script>
	<!-- <script type="text/javascript" charset="utf-8" src="http://agenthubdev.53ai.com/api/libs/js/UEditor/ueditor.config.js"></script> -->
	<!-- <script type="text/javascript" charset="utf-8" src="http://agenthubdev.53ai.com/api/libs/js/UEditor/ueditor.all.min.js"></script> -->
	<script type="text/javascript">
		var configScript = document.createElement('script')
		configScript.src = location.origin + '/console/UEditor/ueditor.config.js'
		configScript.id = 'ueditor-config'
		configScript.onload = () => {
			var allScript = document.createElement('script')
			allScript.src = location.origin + '/console/UEditor/ueditor.all.min.js'
			allScript.id = 'ueditor-all'
			allScript.onload = () => {
				window.UEDITOR_HOME_URL = location.origin + '/console/UEditor/'
				window.ueInstance = UE.getEditor('ueditor-container', {
					autoHeightEnabled: false,
					elementPathEnabled: false,
					focus: true,
					initialFrameWidth: '100%',
					initialFrameHeight: '100%',
					maximumWords: 1000000,
					allowDivTransToP: false
				});
				window.ueInstance.ready(function () {
					if (window.parent) {
						window.parent.postMessage({ action: 'ueditor-ready' }, '*')
					}
				})
			}
			document.body.appendChild(allScript)
		}
		document.body.appendChild(configScript)
		window.addEventListener('message', (e) => {
			const data = e.data || {}
			const action = data.action || ''
			const value = data.value || ''
			if (action === 'getHtml') {
				window.parent.postMessage({ action: 'getHtml', value: window.ueInstance.getContent() }, '*')
			}
			if (action === 'setValue') {
				window.ueInstance.setContent(value)
			}
		})
	</script>
	<style>
		html, body {
			width: 100%;
			height: 100%;
			margin: 0;
			padding: 0;
			box-sizing: border-box;
			overflow: hidden;
		}
		#ueditor-container {
			width: 100%;
			height: 100%;
		}
		#ueditor-container .edui-editor {
			width: 100%;
			height: 100%;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
		}
		#ueditor-container .edui-editor-iframeholder {
			flex: 1;
			height: 0 !important;
			/* overflow: auto !important; */
		}
		#ueditor-container .edui-editor-iframeholder iframe {
			height: 100% !important;
		}
	</style>
</body>

</html>
